//
//  main.swift
//  PerfectTemplate
//
//  Created by Kyle Jessup on 2015-11-05.
//	Copyright (C) 2015 PerfectlySoft, Inc.
//
//===----------------------------------------------------------------------===//
//
// This source file is part of the Perfect.org open source project
//
// Copyright (c) 2015 - 2016 PerfectlySoft Inc. and the Perfect project authors
// Licensed under Apache License v2.0
//
// See http://perfect.org/licensing.html for license information
//
//===----------------------------------------------------------------------===//
//

import PerfectLib
import PerfectHTTP
import PerfectHTTPServer
import PerfectMustache
import MySQLStORM

//设置数据库
MySQLConnector.host        = "127.0.0.1"
MySQLConnector.username    = "root"
MySQLConnector.password    = "Test@123456"
MySQLConnector.database    = "test"

//创建HTTPServer
let server = HTTPServer()
//设置端口
server.serverPort = 8080
//设置静态文件目录，并添加映射目录
server.documentRoot = "./webroot"

//添加AdminWEB页面跳转路由
server.addRoutes(AdminWEB().pageRoutes)
//添加AdminAPI请求路由
server.addRoutes(AdminAPI().apiRoutes)

do {
    try server.start()
} catch {
	fatalError("\(error)") // fatal error launching one of the servers
}

